package com.lagou.edu.utils;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

/**
 * @description
 * @author: liuhongfei
 * @create: 2021/12/7 18:42
 */
@Component
@Aspect
public class LogUtils {

    @Pointcut("execution(* com.lagou.edu.service.impl.TransferServiceImpl.transfer(..) )")
    public void pt1() {

    }

    @Before("pt1()")
    public void beforeMethod(JoinPoint joinPoint) {
        System.out.println("前置通知：业务执行前执行");
    }

    @After("pt1()")
    public void afterMethod() {
        System.out.println("后置通知：业务执行后执行");
    }


    @AfterThrowing("pt1()")
    public void exceptionMethod(JoinPoint joinPoint) {
        System.out.println("报错通知：业务报错时执行");
    }

    @AfterReturning("pt1()")
    public void successMethod() {
        System.out.println("成功通知：业务执行正常时执行");
    }

}
